package chapter06

import scala.beans.BeanProperty

/**
  * Scala会自动引入常用包
  *   java.lang.*
  *   scala
  *   scala.Predef
  */
object Test03_Class {
  def main(args: Array[String]): Unit = {
    val student = new Student()
    println(student.getAge)

    println(student.getGender)
  }
}


class Student {


  // 私有成员，不能被外部访问
  private var name: String = "alice"
  // getter和setter方法
  @BeanProperty
  var age: Int = _
  @BeanProperty
  var gender: String = _ //_ 默认值，String 为 null
}


